<template>
  <div class="map-setting">
    <div class="setting-title">
      <span class="title">地图设置</span>
    </div>
    <div class="attr-item-edit-wrapper pdt10">
      <p class="attr-item-title">背景颜色</p>
      <div class="attr-item-edit-input selectColor">
        <el-input
          size="mini"
          placeholder=""
          v-model="mapStyle.backgroundColor"
          class="input-with-select"
        >
        </el-input>
        <el-color-picker
          size="mini"
          :show-alpha="true"
          v-model="mapStyle.backgroundColor"
        >
        </el-color-picker>
      </div>
    </div>
    <div class="attr-item-edit-wrapper">
      <p class="attr-item-title pdt10">缩放</p>
      <div class="col-2 attr-item-edit-input">
        <el-slider
          v-model="amap.zooms"
          range
          :min="0"
          :max="20"
          input-size="mini"
          :step="0.1"
        ></el-slider>
        <div class="attr-item-edit-input-des">默认范围（0-20）</div>
      </div>
      <div class="col-2 attr-item-edit-input pdt5">
        <el-input-number
          v-model="amap.zooms[0]"
          controls-position="right"
          :min="0"
          :max="20"
          input-size="mini"
          :step="0.1"
        ></el-input-number>
      </div>
    </div>
    <div class="attr-item-edit-wrapper">
      <p class="attr-item-title"></p>
      <div class="col-2 attr-item-edit-input">
        <el-slider
          v-model="amap.zoom"
          :min="0"
          :max="20"
          input-size="mini"
          :step="0.1"
        ></el-slider>
        <div class="attr-item-edit-input-des">默认级别（0-20）</div>
      </div>
      <div class="col-2 attr-item-edit-input pdt5">
        <el-input-number
          v-model="amap.zoom"
          controls-position="right"
          :min="0"
          :max="20"
          input-size="mini"
          :step="0.1"
        ></el-input-number>
      </div>
    </div>
    <div class="attr-item-edit-wrapper">
      <p class="attr-item-title pdt10">地图中心</p>
      <div class="col-2 attr-item-edit-input">
        <el-slider
          v-model="amap.center[0]"
          :min="-180"
          :max="180"
          input-size="mini"
          :step="0.0001"
        ></el-slider>
        <div class="attr-item-edit-input-des">经度（-180~180）</div>
      </div>
      <div class="col-2 attr-item-edit-input pdt5">
        <el-input-number
          v-model="amap.center[0]"
          controls-position="right"
          :min="-180"
          :max="180"
          input-size="mini"
          :step="0.0001"
        ></el-input-number>
      </div>
    </div>
    <div class="attr-item-edit-wrapper">
      <p class="attr-item-title"></p>
      <div class="col-2 attr-item-edit-input">
        <el-slider
          v-model="amap.center[1]"
          :min="-90"
          :max="90"
          input-size="mini"
          :step="0.0001"
          controls-position="right"
        ></el-slider>
        <div class="attr-item-edit-input-des">纬度（-90~90）</div>
      </div>
      <div class="col-2 attr-item-edit-input pdt5">
        <el-input-number
          v-model="amap.center[1]"
          :min="-90"
          :max="90"
          input-size="mini"
          :step="0.0001"
          controls-position="right"
        ></el-input-number>
      </div>
    </div>
    <div class="attr-item-edit-wrapper">
      <p class="attr-item-title pdt3">通用坐标</p>
      <div
        class="col-1 attr-item-edit-input"
        style="text-align: left"
      >
        <el-select
          v-model="value"
          placeholder="请选择"
          size="mini"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </div>
    </div>
  </div>
</template>
<script>
import { mapState, mapGetters } from "vuex";
import { throttle } from "lodash";
export default {
  components: {},
  data() {
    return {
      backgroundColor: "",
      value: "EPSG3857",
      num: 0,
      num1: 0,
      options: [
        {
          value: "EPSG3857",
          label: "EPSG3857",
        },
        {
          value: "EPSG4326",
          label: "EPSG4326",
        },
        {
          value: "BD09",
          label: "BD09",
        },
      ],
    };
  },
  computed: {
    ...mapState({
      // projectData: state => state.editor.projectData,
      // activePageUUID: state => state.editor.activePageUUID,
      // activeElementUUID: state => state.editor.activeElementUUID
    }),
    ...mapGetters([
      // 'currentPageIndex',
      // 'activeElementIndex',
      "activeElement",
    ]),
    mapStyle() {
      return this.activeElement && this.activeElement.commonStyle;
    },
    bgColor() {
      return (
        this.activeElement &&
        this.activeElement.propsValue.mapConfig.option.backgroundColor
      );
    },
    amap() {
      return (
        this.activeElement &&
        this.activeElement.propsValue.mapConfig.option.amap
      );
    },
  },
  created() {},
  mounted() {},
  methods: {},
};
</script>
<style lang="scss" scoped>
.pdt5 {
  padding-top: 5px;
}
.pdt10 {
  padding-top: 10px;
}
.pdl10 {
  padding-left: 10px;
}
.attr-item-edit-wrapper {
  display: flex;
  width: 100%;
  text-align: center;
  padding-bottom: 10px;
  padding-left: 0;
  .attr-item-title {
    min-width: 60px;
    min-height: 15px;
    text-align: left;
  }
  .attr-item-edit-input {
    &.col-2 {
      width: 120px;
      margin-left: 10px;
      .el-input-number {
        width: 100%;
        line-height: 1.0;
        
        /deep/ span {
          line-height: 14px;
          height: 14px;
        }
        /deep/.el-input__inner {
          width: 100%;
        }
      }
    }
    &.col-1 {
      width: 250px;
    }
    &.col-3 {
      width: 60px;
      margin-left: 10px;
    }
    &.col-4 {
      width: 50px;
      margin-left: 10px;
    }
    .attr-item-edit-input-des {
      text-align: left;
      line-height: 1;
      margin-top: 2px;
      font-size: 12px;
      color: $gray;
    }
  }
}
</style>
<style lang="scss">
.attr-item-edit-wrapper {
  .el-input__icon {
    line-height: 0;
  }
  .selectColor {
    position: relative;
    .el-input__inner {
      padding-right: 30px;
    }
    .el-color-picker {
      position: absolute;
      top: 0;
      right: 0;
    }
  }
}
</style>
<style lang="scss" scoped>
.map-setting {
  padding-top: 10px;
  border-top: 2px solid #ccc;
  .setting-title {
    .title {
      font-size: 14px;
      font-weight: bold;
    }
  }
}
</style>